package com.hotline.communication.service.impl;

import com.hotline.communication.mapper.DutyUserCallMapper;
import com.hotline.communication.dto.DutyUserCallDTO;
import com.hotline.communication.service.DutyUserCallService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class DutyUserCallServiceImpl implements DutyUserCallService {

    @Resource
    private DutyUserCallMapper dutyUserCallMapper;

    @Override
    public DutyUserCallDTO selectByCallId(String callId) {

        DutyUserCallDTO dutyUserCallDTO = dutyUserCallMapper.selectByCallId(callId);

        return dutyUserCallDTO;
    }

    @Override
    public void insert(DutyUserCallDTO dutyUserCallDTO) {
        try {
            log.info("TX_LOG[]duty_user_call[]值班人员呼叫[]新增值班人员呼叫记录[]dutyUserCallDTO:{}",dutyUserCallDTO);
            dutyUserCallMapper.insert(dutyUserCallDTO);
        }catch (Exception e){
            log.error("新增值班人员呼叫记录失败, dutyUserCallDTO={}, cause:{}", dutyUserCallDTO,e.getMessage());
        }
    }

    @Override
    public void update(DutyUserCallDTO dutyUserCallDTO) {
        try {
            log.info("TX_LOG[]duty_user_call[]值班人员呼叫[]新增值班人员呼叫记录[]dutyUserCallDTO:{}",dutyUserCallDTO);
            dutyUserCallMapper.update(dutyUserCallDTO);
        }catch (Exception e){
            log.error("新增值班人员呼叫记录失败, dutyUserCallDTO={}, cause:{}", dutyUserCallDTO,e.getMessage());
        }
    }
}
